#!/bin/bash

if [ ! -d chatgpt ]; then
    mkdir -p chatgpt
fi

# url="https://gitee.com/RockChin/QChatGPT.git"
url="https://github.com/RockChinQ/QChatGPT.git"

if ! git clone --depth=1 "$url" QChatGPT; then
    echo "git clone fail"
    exit 1
fi

if [ -f "chatgpt/main.py" ]; then
    mv -f chatgpt/main.py chatgpt/main.py.backup
fi

rm -rf ./QChatGPT/.git

cp -a ./QChatGPT/. ./chatgpt && rm -rf ./QChatGPT

echo "update bot success, plase restart the docker container"
